package org.neuedu.chapter04_0616;

import java.util.Arrays;

public class ArrayDemo07 {
    public static void main(String[] args) {
        // 冒泡排序
        int[] arr = {5, 2, 3, 1, 4};
        for (int i = 1; i < arr.length; i++) {
            for (int j = 0; j < arr.length - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
